<?php

namespace JsonLowCode\Support;

use JsonLowCode\JsBase;

/**
 * @method static JsHooks make(bool $isFunction = true)
 */
class JsHooks extends JsBase
{
    protected string $hooks = "this.__scope.\$hooks";

    protected array $options = [];

    /**
     * @param bool $isFunction 是否函数包裹
     */
    public function __construct(bool $isFunction = true){
        $this->hooks = Js::hooks();
        $this->setJsFunction($isFunction);
    }

    /**
     * @return string
     */
    public function getHooks(): string
    {
        $this->script = "console.log({$this->hooks})";
        return $this->toString();
    }
}
